<template>
  <ShareLyric :lyric="lyric" :title="title" :qrcodeUrl="qrCodeUrl" @close="handleClose" />
</template>
<script>
import ShareLyric from "@/components/ShareLyric/ShareLyric";
import { getShiJiItem } from "@/api/cloudbase-sgbedit.js";
export default {
  name: "share-lyric-page",
  components: {
    ShareLyric,
  },
  props: {
    id: {
      type: String,
      required: true,
    },
  },
  computed: {
    qrCodeUrl() {
      return `https://star.top237.top/#/playnew/${this.id}/${this.shijiIndex}/shiji`;
    },
  },
  data() {
    return {
      lyric: "",
      title: "",
      shijiIndex: 0,
    };
  },
  mounted() {
    this.init();
  },
  methods: {
    async init() {
      // console.log("this.zameiId-->", this.id)
      try {
        const data = await getShiJiItem(this.id);
        // console.log("data-->", data)
        this.lyric = data.lyric;
        this.title = data.mulu;
        this.shijiIndex = data.shijiIndex;
      } catch (error) {
        console.log("error-->", error);
      }
    },
    handleClose() {
      this.$router.back();
    },
  },
};
</script>
<style scoped lang="less"></style>
